use crate::symbols::symbols::SymbolicExp::{Number, Symbol};
use std::collections::HashMap;

#[test]
fn add_symbols() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let f = x.clone() + y.clone();
    let f1 = f.derivate("x");
    println!("{:?}", f1);
}

#[test]
fn power_symbols() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let m = x.clone() + y.clone() + Number(1.0);
    let n = x.clone() - y.clone();
    let f = m.power(n);
    let f1 = f.derivate("x");

    // 创建一个HashMap
    let scores = &mut HashMap::new();
    // 插入一些键值对
    scores.insert(String::from("x"), 2.0);
    scores.insert(String::from("y"), 3.0);
    let f2 = f.run(scores);
    println!("{:?}", f1);
    println!("{:?}", f2);
}

#[test]
fn three_symbols() {
    let x1 = Symbol("x".to_string());
    let y1 = Symbol("y".to_string());
    println!("{:?}", (x1.clone() + y1.clone()).sin().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).cos().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).tan().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).cot().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).arcsin().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).arccos().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).arctan().derivate("x"));
    println!("{:?}", (x1.clone() + y1.clone()).arccot().derivate("x"));
}

#[test]
fn log_symbols() {
    let x = Symbol("x".to_string());
    let y = Symbol("y".to_string());
    let m = x.clone() + y.clone();
    let n = x.clone() * y.clone();
    let f = m.log(n);
    let f1 = f.derivate("x");
    println!("{:?}", f1);
}
